<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateDyUser extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('dy_user',['id'=>false,'comment'=>'橱窗抖音账号表','collation'=>'utf8mb4_general_ci']);
        $table->addColumn('id', 'biginteger', ['limit' => 20, 'identity' => true, 'signed' => false])
            ->setPrimaryKey('id')
            ->addColumn('user_id','biginteger',['limit'=>20,'default'=>0,'comment'=>'用户id'])
            ->addColumn('dy_id','string',['limit'=>150,'comment'=>'抖音号'])
            ->addColumn('dy_uid','string',['limit'=>32,'default'=>'','comment'=>'抖音uid'])
            ->addColumn('dy_name','string',['limit'=>255,'default'=>'','comment'=>'抖音昵称'])
            ->addColumn('dy_intro','string',['limit'=>255,'default'=>'','comment'=>'抖音简介'])
            ->addColumn('avatar','string',['limit'=>255,'default'=>'','comment'=>'抖音头像'])
            ->addColumn('fans','biginteger',['limit'=>20,'default'=>0,'comment'=>'抖音粉丝总数','signed' => false])
            ->addColumn('follows','biginteger',['limit'=>20,'default'=>0,'comment'=>'抖音关注总数','signed' => false])
            ->addColumn('likes','biginteger',['limit'=>20,'default'=>0,'comment'=>'抖音获赞总数','signed' => false])
            ->addColumn('works','biginteger',['limit'=>20,'default'=>0,'comment'=>'抖音作品总数','signed' => false])
            ->addColumn('is_auth','boolean',['limit'=>1,'default'=>0,'comment'=>'是否授权 1,0未授权'])
            ->addColumn('is_del','boolean',['limit'=>1,'default'=>0,'comment'=>'是否删除 1 0'])
            ->addColumn('create_time','datetime',['comment'=>'创建时间'])
            ->addColumn('update_time','datetime',['comment'=>'更新时间'])
            ->create();
    }
}
